package com.javafactroy.kunlong.check;

import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.base.Verify;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TcheckData {
    public <T> void check(T data, String exps) {

        List<String> strs = StrUtil.split(exps, "|");
        strs.forEach(i -> {

            List<String> keyValue = StrUtil.split(i, "=");
            Object value = ReflectUtil.getFieldValue(data, keyValue.get(0));
            Verify.verify(value.toString().equalsIgnoreCase(keyValue.get(1)));
        });


    }

    public <T> void check(List<T> datas, String... exps) {
            for(T data:datas){

            }
    }
}